import unittest
from main import calculate_discounted_bill


class TestBillDiscount(unittest.TestCase):
    def test_no_discount(self):
        bill_amount = 50
        expected = 50
        result = calculate_discounted_bill(bill_amount)
        self.assertEqual(result, expected)
        print(f"Test Case 1: For a bill amount of {bill_amount} yuan, expected final bill {expected} yuan, got {result} yuan. Test passed.")
        print(f"测试用例 1: 对于账单金额 {bill_amount} 元，预期最终账单 {expected} 元，实际得到 {result} 元。测试通过。")

    def test_10_percent_discount(self):
        bill_amount = 150
        expected = 150 * 0.9
        result = calculate_discounted_bill(bill_amount)
        self.assertEqual(result, expected)
        print(f"Test Case 2: For a bill amount of {bill_amount} yuan, expected final bill {expected} yuan, got {result} yuan. Test passed.")
        print(f"测试用例 2: 对于账单金额 {bill_amount} 元，预期最终账单 {expected} 元，实际得到 {result} 元。测试通过。")

    def test_15_percent_discount(self):
        bill_amount = 250
        expected = 250 * 0.85
        result = calculate_discounted_bill(bill_amount)
        self.assertEqual(result, expected)
        print(f"Test Case 3: For a bill amount of {bill_amount} yuan, expected final bill {expected} yuan, got {result} yuan. Test passed.")
        print(f"测试用例 3: 对于账单金额 {bill_amount} 元，预期最终账单 {expected} 元，实际得到 {result} 元。测试通过。")

    def test_exactly_100(self):
        bill_amount = 100
        expected = 100 * 0.9
        result = calculate_discounted_bill(bill_amount)
        self.assertEqual(result, expected)
        print(f"Test Case 4: For a bill amount of {bill_amount} yuan, expected final bill {expected} yuan, got {result} yuan. Test passed.")
        print(f"测试用例 4: 对于账单金额 {bill_amount} 元，预期最终账单 {expected} 元，实际得到 {result} 元。测试通过。")

    def test_decimal_amount_10_percent_discount(self):
        bill_amount = 120.5
        expected = 120.5 * 0.9
        result = calculate_discounted_bill(bill_amount)
        self.assertEqual(result, expected)
        print(f"Test Case 5: For a bill amount of {bill_amount} yuan, expected final bill {expected} yuan, got {result} yuan. Test passed.")
        print(f"测试用例 5: 对于账单金额 {bill_amount} 元，预期最终账单 {expected} 元，实际得到 {result} 元。测试通过。")

    def test_decimal_amount_15_percent_discount(self):
        bill_amount = 220.75
        expected = 220.75 * 0.85
        result = calculate_discounted_bill(bill_amount)
        self.assertEqual(result, expected)
        print(f"Test Case 6: For a bill amount of {bill_amount} yuan, expected final bill {expected} yuan, got {result} yuan. Test passed.")
        print(f"测试用例 6: 对于账单金额 {bill_amount} 元，预期最终账单 {expected} 元，实际得到 {result} 元。测试通过。")


if __name__ == "__main__":
    unittest.main()